(function (vc, vm) {

    vc.extends({
        data: {
            shopConfigSmsInfo: {
                smsId: '',
                shopId: '',
                smsCount: '0',
                smsSwitch: '',
                smsPrice:''
            }
        },
        _initMethod: function () {
            $that.loadShopConfigSms();
        },
        _initEvent: function () {
            vc.on('shopConfigSms','listShopSms',function(){
                $that.loadShopConfigSms();
            });
        },
        methods: {
            loadShopConfigSms: function () {
                let param = {
                    params: {
                        page: 1,
                        row: 1,
                        shopId: vc.getCurrentCommunity().shopId
                    }
                };
                //发送get请求
                vc.http.apiGet('/shopSms.listShopSms',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        if (_json.data.length < 1) {
                            return;
                        }
                        vc.copyObject(_json.data[0], $that.shopConfigSmsInfo);
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            refreshShopConfigSmsInfo: function () {
                $that.shopConfigSmsInfo = {
                    smsId: '',
                    shopId: '',
                    smsCount: '0',
                    smsSwitch: '',
                    smsPrice:''

                }
            },
            _openEditShopSmsSwitchModel: function () {
                vc.emit('editShopSmsSwitch', 'openEditShopSmsSwitchModal', $that.shopConfigSmsInfo);
            },
            _openBuySmsModel:function(){
                vc.emit('buyShopSms', 'openBuyShopSmsModal', $that.shopConfigSmsInfo);
            },
            _toSmsDetail:function(){
                vc.jumpToPage('/#/pages/shop/shopSmsDetail')
            }
        }
    });

})(window.vc, window.$that);
